// 创建，两种方式，接受数组，add 添加
let set = new Set()
set.add(1);
// console.log(set)
let set2 = new Set([1,2,3,4])
// console.log(set2);

// 方法 clear() add() foreach()  delete()删除指定元素。
// has() set.size
set2.add(5)
console.log(set2.has(5))
// set2.forEach(item =>console.log(item));
console.log(set2.delete(5));

console.log(set2.size);




console.log(set2);
console.log(set2.clear());

console.log("********");
//map 创建
let map = new Map([
    ['key1','value1'],
    ['key2','value2'],
    ['key3','value3']
])
let set3 = new Set([
    ['key1','value1'],
    ['key2','value2'],
    ['key3','value3']
])
let map2 = new Map (set3)
let map3 = new Map(map2)

//方法，set（key,value) clear delete(key) has(key),
/**
 * foreach((key,value)=>console.lgo(key,value))
 * size
 */
//特殊,values() keys() map.entries()
for(let item of map.values()){
    console.log(item)
}
for(let item of map.keys()){
    console.log(item)
}
for(let item of map.entries()){
    console.log(item);
    
}
console.log(map.get("key1"));
map3.set('key9','value9')
map3.delete('key3')
console.log(map3)

